A Formally Specified Type System and Operational Semantics for Higher-Order Procedural Variables

نویسندگان

  • Tristan Crolard
  • Emmanuel Polonowski
چکیده

We formally specified the type system and operational semantics of Loop with Ott and Isabelle/HOL proof assistant. Moreover, both the type system and the semantics of Loop have been tested using Isabelle/HOL program extraction facility for inductively defined relations. In particular, the program that computes the Ackermann function type checks and behaves as expected. The main difference (apart from the choice of an Ada-like concrete syntax) with Loop comes from the treatment of parameter passing. Indeed, since Ott does not currently fully support α-conversion, we rephrased the operational semantics with explicit aliasing in order to implement the out parameter passing mode. Introduction We formally specified the type system and operational semantics of Loopω as described in [CPV09] with Ott [SNO+07] and Isabelle/HOL proof assistant [NPW02]. Moreover, both the type system and the semantics of Loopω have been tested using Isabelle/HOL program extraction facility for inductively defined relations [BN02]. In particular, the program that computes the Ackermann function (reproduced below) type checks and behaves as expected. The main difference (apart from the choice of an Ada-like concrete syntax) with the description given in [CPV09] comes from the treatment of parameter passing. Indeed, since Ott does not currently fully support α-conversion, we rephrased the operational semantics with explicit aliasing in order to implement the out parameter passing mode (instead of a simpler substitution-based semantics as in [CPV09]). On the other hand, the in parameter passing mode is implemented exactly as in [CPV09] and relies on Ott generated substitution (see the Isabelle/HOL code given in appendix). Section 1 contains the description of an Ada-like grammar for Loopω. We then present the type system in Section 2 and the structural operational semantic in section 3. Finally, in the appendix we include the Isabelle/HOL theory generated by Ott (all source files are available on request). Example: the Ackermann function procedure Ack(M : in int; N : in int; R : out int) is P : proc(in int, out int) := Incr; begin for I in 1 . . M loop declare Q : constant proc(in int, out int) := P; procedure Aux(S : in int; R : out int) is X : int := 0; begin Q(1, X); for J in 1 . . S loop Q(X, X); end loop; R := X; end; begin P := Aux; end; end loop; P(N, R); end; 1 ha l-0 03 85 41 6, v er si on 1 19 M ay 2 00 9 1 Syntax index , i , j , l , n indices ident , x , y , z , p, f idents number , q terminals ::= | −→ | → | ⇒ | ← | %→ | ! | & | ∅ | × | (= | := | 〈 | 〉 | ∼ | (∈ | ! mode, m ::= modes: | S | in | out | in out integer , k ::= | q | { k1 + k2 } | { k1 − k2 } | { k1 × k2 } boolean, b ::= | true | false | { b1 and b2 } | { b1 or b2 } | { not b } | { k1 = k2 } | k1 > k2 | k1 < k2 exp, e ::= terms: | x var | v value | e1 + e2 addition | e1 − e2 subtraction | e1 × e2 multiplication | e1 = e2 equality | e1 > e2 greater | e1 < e2 less | e1 and e2 conjunction | e1 or e2 disjunction | not e negation | ( e ) S parentheses

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

A Formally Specified Program Logic for Higher-Order Procedural Variables and non-local Jumps

We formally specified a program logic for higher-order procedural variables and non-local jumps with Ott and Twelf. Moreover, the dependent type systems and the translation are both executable specifications thanks to Twelf’s logic programming engine. In particular, relying on Filinski’s encoding of shift/reset using callcc/throw and a global metacontinuation (simulated in state passing style),...

متن کامل

Call-by-push-value: Decomposing call-by-value and call-by-name

We present the call-by-push-value (CBPV) calculus, which decomposes the typed call-by-value (CBV) and typed call-by-name (CBN) paradigms into fine-grain primitives. On the operational side, we give big-step semantics and a stack machine for CBPV, which leads to a straightforward push/pop reading of CBPV programs. On the denotational side, we model CBPV using cpos and, more generally, using alge...

متن کامل

Formal Semantics of Hybrid Chi

The verification formalism / modeling and simulation language hybrid Chi is defined. The semantics of hybrid Chi is formally specified using Structured Operational Semantics (SOS) and a number of associated functions. The χ syntax and semantics can also deal with local scoping of variables and/or channels, implicit differential algebraic equations, such as higher index systems, and they are ver...

متن کامل

The Type of Audit Firms Mergers in Iran: Formal or Real

Although increased mergers of audit firms in the Iranian audit market has attracted the attention of profession, regulatory bodies and researchers, little evidence is available on the motivations, barriers, processes, types, consequences and reasons for failures of audit firm’s mergers. Therefore, the present study is an attempt to open the black box of mergers of audit firms through in-depth i...

متن کامل

Agent Programming in Dribble: From Beliefs to Goals with Plans

To support the practical development of intelligent agents, several programming languages have been introduced that incorporate concepts from agent logics: on the one hand, we have languages that incorporate beliefs and plans (i.e., procedural goals), and on the other hand, languages that implement the concepts of beliefs and (declarative) goals. We propose the agent programming language Dribbl...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • CoRR

دوره abs/0910.1020  شماره 

صفحات  -

تاریخ انتشار 2009